package com.jrx.anytxn.customer.constant;

import com.jrx.anytxn.common.uitl.StringUtils;
import org.springframework.stereotype.Component;

import java.util.Arrays;
import java.util.List;

/**
 * 和银行卡信息有关的信息常量
 *
 * @author Yangxin
 * @date 2019-08-06 15:51
 **/
@Component
public final class BankCardConstant {
    private BankCardConstant() {
    }

    /*
     * 银行卡状态
     */
    //解绑
    public static final String STATUS_BANKCARD_0 = "0";
    //绑定
    public static final String STATUS_BANKCARD_1 = "1";

    /*
    * 客户信息维护类型
     */
    //11-客群标志调整
    public static final String TYPE_11 = "11";
    //12-客户信息修改
    public static final String TYPE_12 = "12";
    //21-银行卡解绑
    public static final String TYPE_21 = "21";
    //22-银行卡设置默认收还款标志
    public static final String TYPE_22 = "22";
    //31-额度冻结解冻
    public static final String TYPE_31 = "31";
    //32-额度调整
    public static final String TYPE_32 = "32";

    /*
     * 银行卡绑定类型
     */
    //放&还款卡
    public static final String BINDTYPE_0 = "0";
    //放款卡
    public static final String BINDTYPE_1 = "1";
    //还款卡
    public static final String BINDTYPE_2 = "2";
    //仅绑卡
    public static final String BINDTYPE_3= "3";

    /*
     * 默认卡标志
     */
    //默认
    public static final String DEFAULT_FLAG_Y = "Y";
    //非默认
    public static final String DEFAULT_FLAG_N = "N";

    /*
     * 银行卡默认标识
     */
    //收款
    public static final String DEFAULT_FLAG_GET = "defaultGetFlag";
    //还款
    public static final String DEFAULT_FLAG_PAY = "defaultPayFlag";

    /**
     * 本行卡开头
     */
    public static final List<String> INNER_CARD_STARTS_WITH = Arrays.asList("623623","623643");

    /**
     * 是否本行卡
     * @param cardNum
     * @return
     */
    public static boolean innerCardFlag(String cardNum){
        return INNER_CARD_STARTS_WITH.stream().anyMatch(bankcard -> StringUtils.isNotBlank(cardNum) && cardNum.startsWith(bankcard));
    }


}
